package Control;

import javax.swing.JOptionPane;

import Entity.NeedyResident_DeleteAccount;
import Form.NeedyResident_DeleteUser_Form;

public class NeedyResident_DeleteUser_Control {
	
private NeedyResident_DeleteUser_Form parser;
	
	public NeedyResident_DeleteUser_Form getParser() {
		return parser;
	}

	public void setPaser(NeedyResident_DeleteUser_Form parser) {
		this.parser = parser;
	}

	NeedyResident_DeleteAccount resident = new NeedyResident_DeleteAccount();
	
	public NeedyResident_DeleteUser_Control(NeedyResident_DeleteUser_Form parser){
		this.setPaser(parser);
		
	}
	
	public NeedyResident_DeleteAccount DeleteAccount(){
		
		resident.setNric(getParser().getLbl_nric().getText());
		boolean success = resident.deleteResident();
		
		if (success == true)
			JOptionPane.showMessageDialog(null, "Account has been deleted");
		else
			JOptionPane.showMessageDialog(null, "Error occured, please try again");
		
		return resident;
	}

}
